package com.itheima.mapper;

import com.itheima.domain.Trip;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TripMapper {
    //1、查询行程表中所有的数据
    @Select("select * from tb_trip")
    public List<Trip> selectAll();
//2、添加用户过年的形成数据

    @Insert("insert into tb_user value(null,#{username},#{gender},#{idcard},#{fromAddress},#{toAddress},#{startTime})")
    int add(Trip trip);
    //3、根据ID查询用户的行程数据
    @Select("select * from tb_trip where id=#{id}")
    Trip select(Integer id);
    //4、根据ID修改用户的行程数据
    @Update("update tb_trip set (null,username=#{username},gender=#{gender},idcard=#{idcard},from_address=#{fromAddress},to_address=#{toAddress},startTime=#{startTime} where id =#{id}\")")
    int update(Trip id);
    //5、根据ID删除用户的行程数据
    @Delete("delete from tb_trip where id=#{id}")
    int delete(Integer id);

}
